package cn.hongye.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cn.hongye.common.JsonResult;
import cn.hongye.model.HistoryQueryVo;
import cn.hongye.service.HistoryRecordService;

@RestController
@RequestMapping("/hotelMgmt/historyRecordMgmt")
public class HistoryRecordController {
	
	@Autowired
	private HistoryRecordService historyRecordService;
	
	private static final Logger logger = LoggerFactory.getLogger(HistoryRecordController.class);
	
	/**
	 * 查询当前房间开房情况
	 * @return
	 */
	@RequestMapping(value = "/listHistoryRecords", method = RequestMethod.POST)
	public JsonResult listHistoryRecords(@RequestBody HistoryQueryVo historyQueryVo) {
		try {
			return new JsonResult("00000", historyRecordService.listHistoryRecords(historyQueryVo.getCurrentPage(),historyQueryVo.getPageSize()
					, historyQueryVo.getName(), historyQueryVo.getStartDate()));
		} catch (Exception e) {
			logger.error("查询历史记录异常", e);
			return new JsonResult("500");
		}
	}

}
